package com.cbtx.tablet.dialog

import android.app.Dialog
import android.content.Context
import android.graphics.Bitmap
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.Window
import android.widget.ImageView
import com.cbtx.tablet.R

/**
 * author : joker.peng
 * e-mail : joker@fiture.com
 * date   : 2021/7/7 4:31 PM
 * desc   :
 */
class UnbindDialog (var mContext: Context, var qrCodeBitmap: Bitmap?): Dialog(mContext, R.style.MMTheme){

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        requestWindowFeature(Window.FEATURE_NO_TITLE)
        initView()
        hideBottomButton()
    }


    private fun initView() {
        val contentView: View = LayoutInflater.from(mContext).inflate(R.layout.unbind_dialog, null)
        val imageView = contentView.findViewById<ImageView>(R.id.mIvQRCode)
        imageView.setImageBitmap(qrCodeBitmap)
        setContentView(contentView)
    }

    private fun hideBottomButton() {
        val window = window
        val params = window!!.attributes
        params.systemUiVisibility =
            View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_IMMERSIVE
        window.attributes = params
    }
}